<%@page import="com.biz.IUserBiz"%>
<%@page import="com.biz.UserBizImpl"%>
<%@page import="com.entity.UserInfo"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("utf-8");
	UserInfo us=new UserInfo();
	String uname=request.getParameter("uname");
	String pwd=request.getParameter("pwd");
	String sex=request.getParameter("sex");
	String email=request.getParameter("email");
	String phone=request.getParameter("phone");
	us.setUname(uname);
	us.setPwd(pwd);
	us.setSex(sex);
	us.setEmail(email);
	us.setPhone(phone);
	IUserBiz ubiz=new UserBizImpl();
	
	String res=ubiz.checkInfo(us.getUname(), us.getPhone(), us.getEmail());
	if(res.equals("")){
		if(ubiz.regisiter(us)>0){
			%>
			<script>location="/myweb2/login.jsp";</script>
			<%
		}else{
			%>
			<script>alert("注册失败");history.back();</script>
			<%
		}
	}else{
		if(res.equals(uname)){
			%>
			<script>alert("用户名已被注册");history.back();</script>
			<%
		}else if(res.equals(phone)){
			%>
			<script>alert("电话号码已被注册");history.back();</script>
			<%
		}else{
			%>
			<script>alert("邮箱已被注册");history.back();</script>
			<%
		}
	}
%>
